package com.maoye.ossp.common.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.maoye.ossp.common.service.IDataBean;
import com.maoye.ossp.common.util.ApplicationContextUtils;
import com.maoye.ossp.common.util.RequestContext;

/**
 * 常用Contorller
 * 
 * @author zhuangwl
 * 
 */
@Controller
@RequestMapping(value = "common/")
public class CommonController {

	@ResponseBody
	@RequestMapping(value = "getDataList")
	public List<Object> getDataList(HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		response.setContentType("application/json; charset=UTF-8");
		String s_bean = request.getParameter("s_bean");
		IDataBean dataBean = (IDataBean) ApplicationContextUtils.getBean(s_bean);
		RequestContext requestContext = new RequestContext(request);
		List<Object> dataList = dataBean.getDataList(requestContext);
		return dataList;
	}
}
